#include "obstacle.h"

Wall::Wall(){
    free=true;
    x=1000;
    y=500;
    width=10;
    height=150;
//    img.load(":/wall/Image/wall1.png");
}
void Wall::setX(int x){
    this->x=x;
}
void Wall::setY(int y){
    this->y=y;
}
int Wall::getX(){
    return this->x;
}
int Wall::getY(){
    return this->y;
}
int Wall::getWidth(){
    return this->width;
}
int Wall::getHeight(){
    return this->height;
}
QPixmap Wall::getImg(){
    return this->img;
}
void Wall::initWall(int x, int y, int width, int height){
    this->x=x;
    this->y=y;
    this->width=width;
    this->height=height;
}
void Wall::initimage1(){
    img.load(":/wall/Image/wall1.png");
}
void Wall::initimage2(){
    img.load(":/wall/Image/wall2.png");
}
bool Wall::isCollision(int y)
{
    QRect rect_1(this->getX(),this->getY(),this->getWidth(),this->getHeight());
    if(this->getX()==40&&this->getY()<=y&&this->getHeight()+getY()>=y) return true;
    else return false;
}
void Wall::move()
{
    this->x-=30;
}
bool Wall::done()
{
    if(this->getX()<=(-this->getWidth())) return true;
    else return false;
}
void Wall::befree(){
    if(this->done()){
        this->free=true;
    }
}
